﻿<div ng-controller="orderController">
	<div class="wrapper border-bottom white-bg page-heading">
		<div class="col-lg-pull-12">
			<ol class="breadcrumb">
				<li>商品订单</li>
			</ol>
		</div>
	</div>

	<form class="form-horizontal row">
		<div class="form-group">
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">商户号</label>
				<div class="col-sm-8">
					<input name="merchant_id" type="text" class="form-control input-sm" ng-model="query.merchant_id">
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">订单号/交易号</label>
				<div class="col-sm-8">
					<input name="order_no" type="text" class="form-control input-sm" ng-model="query.order_no">
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">账号/名称</label>
				<div class="col-sm-8">
					<input name="q" type="text" class="form-control input-sm" ng-model="query.q">
				</div>
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">状态</label>
				<div class="col-sm-8">
                    <select class="form-control input-sm" ng-model="query.order_status">
                        <option value="">全部</option>
                        <option value="1">待付款</option>
                        <option value="2">已支付</option>
                        <option value="3">待确认</option>
                        <option value="4">已完成</option>
                        <option value="5">已关闭</option>
                    </select>
				</div>
			</div>
			<div class="col-sm-4">
				<label class="col-sm-4 control-label">注册时间</label>
				<div class="col-sm-8">
					<div date class="input-group date">
						<input class="form-control input-sm" ng-model="query.start_time">
						<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
					</div>
				</div>
			</div>
			<div class="col-sm-4">
				<div class="col-sm-8">
					<div date class="input-group date">
						<input class="form-control input-sm" ng-model="query.end_time">
						<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
					</div>
				</div>
			</div>
		</div>
        <div class="form-group">
            <div class="col-sm-4">
                <label class="col-sm-4 control-label">来源</label>
                <div class="col-sm-8">
                    <select class="form-control input-sm" ng-model="query.order_type">
                        <option value="">全部</option>
                        <option value="0">爱地球</option>
                        <option value="1">海淘乐</option>
                        <option value="2">候鸟</option>
                        <option value="6">集市</option>
                        <option value="7">人脸认证</option>
                    </select>
                </div>
            </div>
            <div class="col-sm-4">
                <div class="col-sm-offset-4 col-sm-8">
                    <button class="btn btn-primary btn-sm" ui-sref="app.order.list(query)"><i class="fa fa-search"></i> 查询</button>
                    <a class="btn btn-primary btn-sm" ng-click="search()"><i class="fa fa-refresh"></i> 刷新</a>
                    <!--<button class="btn btn-primary btn-sm"><i class="fa fa-download"></i> 导出</button>-->
                </div>
            </div>
        </div>
	</form>
	<table class="table table-hover m-t-md">
		<thead>
			<tr style="background-color: #f7f7f9;">
				<th>订单号</th>
				<th>商户</th>
				<th>状态</th>
                <th>买家</th>
				<th>订单金额</th>
				<th>补贴</th>
				<th>应付金额</th>
				<th>手续费</th>
				<th>实收金额</th>
				<th>订单时间</th>
				<th width="65">操作</th>
			</tr>
		</thead>
		<tbody ng-repeat="item in model.rows">
			<tr>
				<td colspan="10">
					<p>支付方式：{{item.pay_info.pay_name}} 交易号：{{item.pay_info.pay_no}} 支付流水号：{{item.pay_info.transaction_no}} </p>
				</td>
			</tr>
			<tr>
				<td>{{item.order_no}}</td>
				<td>{{item.merchant.name}}<br />{{item.merchant.mobile}}</td>
                <td>{{get_order_status(item.status)}}</td>
                <td>{{item.buyer == null ? "匿名":item.buyer.mobile}}</td>
                <td>{{item.order_amount > 0 || item.red_drill == 0 ? item.order_amount :""}}{{item.order_amount > 0 && item.red_drill > 0 ? " + " :""}}{{item.red_drill > 0 ? item.red_drill +"红钻" : ""}}</td>
				<td>{{item.subsidy_amount}}</td>
                <td>{{item.pay_amount > 0 || item.red_drill == 0 ? item.pay_amount :""}}{{item.pay_amount > 0 && item.red_drill > 0 ? " + " :""}}{{item.red_drill > 0 ? item.red_drill +"红钻" : ""}}</td>
				<td>{{item.fee_amount}}</td>
                <td>{{item.amount > 0 || item.red_drill == 0 ? item.amount :""}}{{item.amount > 0 && item.red_drill > 0 ? " + " :""}}{{item.red_drill > 0 ? item.red_drill +"红钻" : ""}}</td>
				<td>{{item.order_time}}</td>
				<td>
					<a class="btn btn-primary btn-xs" ui-sref="app.order.detail({id:{{item.id}}})"><i class="fa fa-cog"></i> 详情</a>
				</td>
			</tr>
		</tbody>
	</table>
	<div class="row">
		<div class="col-md-12">
			<uib-pagination total-items="model.total_result" items-per-page="model.size" ng-model="model.page" num-pages="model.total_pages"
							ng-change="search_page(model.page)" class="pagination-sm" boundary-links="true" boundary-link-numbers="true" max-size="20"
							previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination>
			<span class="pull-right" style="margin: 30px 0px 20px 0px">共{{model.total_result}} 当前：{{model.page}}/{{model.total_pages}}</span>
		</div>
	</div>
</div>
